package com.gxa.web_admin.controller.operationscontroller;

import com.gxa.common.R;
import com.gxa.modules.pojo.Build;
import com.gxa.modules.pojo.PublicResources;
import com.gxa.modules.service.operationsservice.GongGongZiYuanService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/GongGongZiYuan")
@Api(value = "资产管理模块",tags = "资产信息模块-公共资源管理模块API")
public class GongGongZiYuanController {

    @Autowired
    private GongGongZiYuanService gongGongZiYuanService;


    @RequestMapping(value = "/selectGongGongZiYuan",method = RequestMethod.GET)
    @ApiOperation(value = "查询公共资源信息",notes = "根据传入信息查询公共资源信息，传入参数条件查询，不传参数全部查询",httpMethod = "GET", response = R.class)
    @ApiImplicitParams({
            @ApiImplicitParam(name = "publicName",value = "公共资源名称",paramType = "query",dataType = "String"),
            @ApiImplicitParam(name = "page",value = "页数",required = true,paramType = "query",dataType = "int"),
            @ApiImplicitParam(name = "limit",value = "每页条数",required = true,paramType = "query",dataType = "int")
    })
    public R selectGongGongZiYuan(String publicName,int page,int limit){
        return gongGongZiYuanService.selectGongGongZiYuan(publicName,page,limit);
    }
    @RequestMapping(value = "/delGongGongZiYuan",method = RequestMethod.POST)
    @ApiOperation(value = "删除公共资源信息",notes = "根据传入公共资源id删除公共资源信息,",httpMethod = "POST", response = R.class)
    @ApiImplicitParams({
//            @ApiImplicitParam(name = "buildName",value = "所属楼宇",paramType = "query",dataType = "String"),
//            @ApiImplicitParam(name = "page",value = "页数",required = true,paramType = "query",dataType = "int"),
            @ApiImplicitParam(name = "ids",value = "想要删除的公共资源id,用,分隔回传String",required = true,paramType = "query",dataTypeClass = String.class)
    })
    public R delGongGongZiYuan(@RequestParam String ids){
//        System.out.println(ids);
        return gongGongZiYuanService.delGongGongZiYuan(ids);
    }
    @RequestMapping(value = "/insertGongGongZiYuan",method = RequestMethod.POST)
    @ApiOperation(value = "新增公共资源信息",notes = "新增公共资源信息,",httpMethod = "POST", response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "buildName",value = "楼宇名称",paramType = "query",dataType = "String"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "ids",value = "想要删除的楼宇id,用,分隔回传String",required = true,paramType = "query",dataTypeClass = String.class)
//    })
    public R insertGongGongZiYuan(@RequestBody PublicResources publicResources){
//        System.out.println(ids);
        return gongGongZiYuanService.insertGongGongZiYuan(publicResources);
    }
    @RequestMapping(value = "/updGongGongZiYuan",method = RequestMethod.POST)
    @ApiOperation(value = "修改公共资源信息",notes = "修改公共资源信息，公共资源id必传",httpMethod = "POST", response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "buildName",value = "楼宇名称",paramType = "query",dataType = "String"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "propertyFee",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "ids",value = "想要删除的楼宇id,用,分隔回传String",required = true,paramType = "query",dataTypeClass = String.class)
//    })
    public R updGongGongZiYuan(@RequestBody PublicResources publicResources){
//        System.out.println(ids);
        return gongGongZiYuanService.updGongGongZiYuan(publicResources);
    }
    @RequestMapping(value = "/selectLouYu",method = RequestMethod.GET)
    @ApiOperation(value = "查询楼宇信息",notes = "查询楼宇信息",httpMethod = "GET", response = R.class)
//    @ApiImplicitParams({
//            @ApiImplicitParam(name = "buildName",value = "楼宇名称",paramType = "query",dataType = "String")
//            @ApiImplicitParam(name = "page",value = "页数",required = true,paramType = "query",dataType = "int"),
//            @ApiImplicitParam(name = "limit",value = "每页条数",required = true,paramType = "query",dataType = "int")
//    })
    public R selectLouYu(){
        return gongGongZiYuanService.selectLouYu();
    }
}
